import React from 'react';
import { Button, Dialog, Radio, Form, Input } from 'antd-mobile'
import url from '../config/url';
import req from "../http/req"
const Form2 = () => {
  const onFinish = (values) => {
    console.log(values);
    req.post(url.AddUser,values).then(res=>{
      console.log(res.data);
      if(res.data.errNo===0){
        Dialog.clear()
      }
  })
  }
  return (
    <div>
      <Form layout='horizontal' onFinish={onFinish}>
        <Form.Header>添加用户信息</Form.Header>
        <Form.Item label='用户名' name='username'>
          <Input placeholder='请输入'/>
        </Form.Item>
        <Form.Item label='密码' name='password'>
          <Input placeholder='请输入'/>
        </Form.Item>
        <Form.Item label='邮箱' name='email'>
          <Input placeholder='请输入'/>
        </Form.Item>
        <Form.Item
          label="性别"
          name='gender'
        >
          <Radio.Group>
            <Radio value="1"> 男 </Radio>
            <Radio value="2"> 女 </Radio>
            <Radio value="3"> 保密 </Radio>
          </Radio.Group>
        </Form.Item>
        <Form.Item
          label="状态"
          name='status'
        >
          <Radio.Group>
            <Radio value="1"> 正常 </Radio>
            <Radio value="2"> 禁用 </Radio>
          </Radio.Group>
        </Form.Item>
        <Form.Item label='手机号' name='mobile'>
          <Input placeholder='请输入'/>
        </Form.Item>
        <Form.Item >
          <Button type="primary" htmlType="submit">
            添加
          </Button>
        </Form.Item>
      </Form>
    </div>
  );
}

export default Form2;
